<?php

/* @var think\Route $router */

$router->group(function () use ($router){
    // 角色
    $router->resource('roles', '\catchAdmin\permissions\controller\Role');
    $router->get('role/permissions/<id>', '\catchAdmin\permissions\controller\Role@getPermissions');
    // 权限
    $router->resource('permissions', '\catchAdmin\permissions\controller\Permission');
    $router->put('permissions/show/<id>', '\catchAdmin\permissions\controller\Permission@show');
    // 部门
    $router->resource('departments', '\catchAdmin\permissions\controller\Department');
    // 所有职位
    $router->get('jobs/all', '\catchAdmin\permissions\controller\Job@getAll');
    // 岗位
    $router->resource('jobs', '\catchAdmin\permissions\controller\Job');
    // 用户
    $router->resource('users', '\catchAdmin\permissions\controller\User');
    // 切换状态
    $router->put('users/switch/status/<id>', '\catchAdmin\permissions\controller\User@switchStatus');
    $router->get('user/info', '\catchAdmin\permissions\controller\User@info');
    $router->get('user/export', '\catchAdmin\permissions\controller\User@export');

    // 用户列表
    $router->post('user/list', '\catchAdmin\permissions\controller\User@list');
    // 我的角色（我的以及下级）用户
    $router->post('user/myRoles', '\catchAdmin\permissions\controller\User@myRoles');
    // 添加用户
    $router->post('user/createUser', '\catchAdmin\permissions\controller\User@createUser');
    // 修改用户
    $router->post('user/updateUser', '\catchAdmin\permissions\controller\User@updateUser');
    // 删除用户
    $router->post('user/delUser', '\catchAdmin\permissions\controller\User@delUser');
    // 用户启用/禁用
    $router->post('user/switchUser', '\catchAdmin\permissions\controller\User@switchUser');
    // 用户列表
    $router->post('user/employeeList', '\catchAdmin\permissions\controller\User@employeeList');


    // 添加员工
    $router->post('user/createEmployee', '\catchAdmin\permissions\controller\User@createEmployee');
    // 修改员工
    $router->post('user/updateEmployee', '\catchAdmin\permissions\controller\User@updateEmployee');
    // 删除员工
    $router->post('user/delEmployee', '\catchAdmin\permissions\controller\User@delEmployee');
    // 员工启用/禁用
    $router->post('user/switchEmployee', '\catchAdmin\permissions\controller\User@switchEmployee');


    // 口岸配置
    // 口岸列表
    $router->post('port/portList', '\catchAdmin\permissions\controller\Port@portList');
    // 创建口岸
    $router->post('port/createPort', '\catchAdmin\permissions\controller\Port@createPort');
    // 修改口岸
    $router->post('port/updatePort', '\catchAdmin\permissions\controller\Port@updatePort');
    // 删除口岸
    $router->post('port/delPort', '\catchAdmin\permissions\controller\Port@delPort');
})->middleware('auth');
$router->rule('port/portConfig', '\\catchAdmin\\permissions\\controller\\Port@portConfig', 'POST');
$router->put('port/profile', '\catchAdmin\permissions\controller\User@profile');
$router->put('user/profile', '\catchAdmin\permissions\controller\User@profile');

